package com.example.zhc36.fragment.dao;

import com.example.zhc36.fragment.bean.Featurebean;

import java.util.List;

import io.realm.Realm;
import io.realm.RealmResults;

public class FeatureDao {

    public List<Featurebean> findshow(){
        Realm realm = Realm.getDefaultInstance();
        RealmResults<Featurebean> all = realm.where(Featurebean.class).equalTo("ShowType", "1").findAll();
        List<Featurebean>  beans = realm.copyFromRealm(all);

        realm.close();
        return beans;


    }

    public List<Featurebean> findAllClose(){
        Realm realm = Realm.getDefaultInstance();
        RealmResults<Featurebean> all = realm.where(Featurebean.class).equalTo("ShowType", "0").findAll();
        List<Featurebean>  beans = realm.copyFromRealm(all);

        realm.close();
        return beans;


    }
    public void Update(Featurebean bean){
        Realm realm = Realm.getDefaultInstance();
        realm.beginTransaction();
        realm.insertOrUpdate(bean);
        realm.commitTransaction();
        realm.close();





    }

}
